{% set pypi_name = 'tripleo-common' %}
{% set upstream_version = upstream_version('13.1.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Python library for code used by TripleO projects
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/tripleo-common
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('GitPython') }}
BuildRequires:  {{ py3('PyYAML') }}
BuildRequires:  {{ py3('docker') }}
BuildRequires:  {{ py3('eventlet') }}
BuildRequires:  {{ py3('python-glanceclient') }}
BuildRequires:  {{ py3('python-heatclient') }}
BuildRequires:  {{ py3('python-ironic-inspector-client') }}
BuildRequires:  {{ py3('python-ironicclient') }}
BuildRequires:  {{ py3('metalsmith') }}
BuildRequires:  {{ py3('mistral-lib') }}
BuildRequires:  {{ py3('python-mistralclient') }}
BuildRequires:  {{ py3('python-novaclient') }}
BuildRequires:  {{ py3('oslo.concurrency') }}
BuildRequires:  {{ py3('oslo.log') }}
BuildRequires:  {{ py3('oslo.rootwrap') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('paramiko') }}
BuildRequires:  {{ py3('passlib') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('setuptools') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('tenacity') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildRequires:  {{ py3('python-zaqarclient') }}
Requires:       ansible
Requires:       {{ py3('Babel') }}
Requires:       {{ py3('GitPython') }}
Requires:       {{ py3('Jinja2') }}
# FIXME(jpena): specifying a version below is apparently needed for RDO
Requires:       {{ py3('docker', ('>=', '2.0.0')) }}
Requires:       {{ py3('eventlet') }}
Requires:       {{ py3('python-glanceclient') }}
Requires:       {{ py3('python-heatclient') }}
Requires:       {{ py3('python-ironic-inspector-client') }}
Requires:       {{ py3('python-ironicclient') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('python-keystoneclient') }}
Requires:       {{ py3('metalsmith') }}
Requires:       {{ py3('mistral-lib') }}
Requires:       {{ py3('python-mistralclient') }}
Requires:       {{ py3('netaddr') }}
Requires:       {{ py3('netifaces') }}
Requires:       {{ py3('python-novaclient') }}
Requires:       {{ py3('oslo.concurrency') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.rootwrap') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('paramiko') }}
Requires:       {{ py3('passlib') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('tenacity') }}
Requires:       {{ py3('python-zaqarclient') }}
BuildArch:      noarch

%description
Python library for code used by TripleO projects.

%package doc
Summary:        Documentation for Python library for code used by TripleO projects
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description      doc
Python library for code used by TripleO projects.
This package contains auto-generated documentation.

%package devtools
Summary: A collection of tools for TripleO developers and CI
Requires: %{name} = %{version}-%{release}

%description devtools
This package installs the TripleO tools for developers and CI that typically
don't fit in a product.

%prep
%autosetup -n {{ pypi_name }}-%{version}
%py_req_cleanup

%build
%{py3_build}

PYTHONPATH=. %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}


%check
%{__python3} -m stestr.cli run

%files
%doc README.rst ChangeLog
%license LICENSE
%{python3_sitelib}/tripleo_common
%{python3_sitelib}/*.egg-info
%dir %{_prefix}/lib/heat
%{_prefix}/lib/heat/undercloud_heat_plugins
%{_bindir}/upload-puppet-modules
%{_bindir}/upload-swift-artifacts
%{_bindir}/tripleo-build-images
%{_bindir}/tripleo-config-download
%{_bindir}/bootstrap_host_exec
%{_bindir}/bootstrap_host_only_exec
%{_bindir}/bootstrap_host_only_eval
%{_datadir}/tripleo-common

%files doc
%license LICENSE
%doc doc/build/html

%files devtools
%{_bindir}/pull-puppet-modules

%changelog

